import React from 'react'
import {
	FileWordFilled,
	FilePptFilled,
	FileImageFilled,
	FileExcelFilled,
	FileUnknownFilled,
} from '@ant-design/icons';
// =====================================================================
const wordlist = ['doc', 'docx','dot','dotx','docm']
const imglist = ['png', 'jpg','jpeg', 'bmp', 'gif', 'webp', 'psd', 'svg', 'tiff']
const pdflist = ['pdf']
const excelist = ['xls', 'xlsx','xltx','xlt','xlsm','xlsb','xltm','csv']
const fileIcon = (file_type) => {
	if(wordlist.includes(file_type)){
		return <FileWordFilled style={{color: '#468ef3', fontSize: 16}} />
	}else if(imglist.includes(file_type)){
		return <FileImageFilled style={{color: '#ff8c00', fontSize: 16}} />
	}else if(pdflist.includes(file_type)){
		return <FilePptFilled style={{color: '#e44c49', fontSize: 16}} />
	}else if(excelist.includes(file_type)){
		return <FileExcelFilled style={{color: '#11ba77', fontSize: 16}} />
	}else{
		return <FileUnknownFilled style={{color: '#f2f2f2', fontSize: 16}}  />
	}
}
// =====================================================================
const Index = () => {
	return { width:300, render: (text, { file_type }) => {
		if(text){
			return (
				<>
					<span className='rel'>{fileIcon(file_type)}<span className='abs_full'></span></span>
					<span>&nbsp;{text}</span>
				</>
			)
		}else{
			return '--'
		}
	} }
}

export default Index